import { Column, Entity, Index, PrimaryGeneratedColumn } from "typeorm";

@Index("gi_geo_location", ["geoLocation"], {})
@Index("idx_biz_account_id", ["bizAccountId"], {})
@Entity("apartment_block", { schema: "cbox" })
export class ApartmentBlock {
  @PrimaryGeneratedColumn({ type: "int", name: "id", unsigned: true })
  id: number;

  @Column("varchar", { name: "title", nullable: true, length: 64 })
  title: string | null;

  @Column("varchar", { name: "location_name", length: 255 })
  locationName: string;

  @Column("int", { name: "address_area_id", unsigned: true })
  addressAreaId: number;

  @Column("geometry", { name: "geo_location" })
  geoLocation: string;

  @Column("int", { name: "biz_account_id", nullable: true })
  bizAccountId: number | null;

  @Column("int", { name: "qualification_id", nullable: true })
  qualificationId: number | null;

  @Column("varchar", { name: "block_type", nullable: true, length: 45 })
  blockType: string | null;

  @Column("varchar", { name: "established_in", nullable: true, length: 16 })
  establishedIn: string | null;

  @Column("varchar", { name: "floor_count", nullable: true, length: 16 })
  floorCount: string | null;

  @Column("varchar", { name: "room_count", nullable: true, length: 16 })
  roomCount: string | null;

  @Column("bit", {
    name: "support_short_term",
    nullable: true,
    default: () => "'b'0''",
  })
  supportShortTerm: boolean | null;

  @Column("bit", {
    name: "elevator_available",
    nullable: true,
    default: () => "'b'1''",
  })
  elevatorAvailable: boolean | null;

  @Column("bit", {
    name: "residence_permit_agent",
    nullable: true,
    default: () => "'b'0''",
  })
  residencePermitAgent: boolean | null;

  @Column("bit", {
    name: "cat_allowed",
    nullable: true,
    default: () => "'b'1''",
  })
  catAllowed: boolean | null;

  @Column("bit", {
    name: "dog_allowed",
    nullable: true,
    default: () => "'b'0''",
  })
  dogAllowed: boolean | null;

  @Column("bit", {
    name: "administrative_region_allowed",
    nullable: true,
    default: () => "'b'1''",
  })
  administrativeRegionAllowed: boolean | null;

  @Column("bit", {
    name: "foreigner_allowed",
    nullable: true,
    default: () => "'b'0''",
  })
  foreignerAllowed: boolean | null;

  @Column("bit", {
    name: "residential_water_electricity",
    nullable: true,
    default: () => "'b'0''",
  })
  residentialWaterElectricity: boolean | null;

  @Column("int", { name: "apartment_block_picture_id", nullable: true })
  apartmentBlockPictureId: number | null;

  @Column("int", { name: "intro_video_id", nullable: true })
  introVideoId: number | null;

  @Column("varchar", { name: "contact_name", nullable: true, length: 32 })
  contactName: string | null;

  @Column("varchar", { name: "contact_phone_num", nullable: true, length: 64 })
  contactPhoneNum: string | null;

  @Column("int", { name: "security_deposit_month", nullable: true })
  securityDepositMonth: number | null;

  @Column("int", { name: "prepayment_month", nullable: true })
  prepaymentMonth: number | null;

  @Column("timestamp", {
    name: "create_time",
    default: () => "CURRENT_TIMESTAMP",
  })
  createTime: Date;

  @Column("timestamp", {
    name: "update_time",
    default: () => "CURRENT_TIMESTAMP",
  })
  updateTime: Date;

  @Column("varchar", {
    name: "approval",
    length: 16,
    default: () => "'pending'",
  })
  approval: string;
}
